package com.ITArmy.dao;

import com.ITArmy.beans.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    int deleteByPrimaryKey(Long uId);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long uId);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    User selectByEmail(String uEmail);

    User findByEmail(@Param("uEmail") String uEmail, @Param("uPwd") String uPwd);

    //批量删除
    int deleteManyByIds(String[] ids);

    /**
     * 根据id进行查询
     */
    User selectById(Long uId);

    /**
     * 遍历用户信息
     */
    List<User> findAllUser();

    /**
     * 减少金币
     */
    void reduceGold(@Param("amount") double amount, @Param("uId") long uId);

    /**
     * 增加金币
     */
    void addGold(@Param("amount") double amount, @Param("uId") long uId);

    /**
     * 根据qqOpenId进行查询用户
     */
    User selectUserByqqOpenId(String qqOpenId);
}